package model;

import java.util.List;
import java.util.Map;
import java.util.Observer;

public class ModelFacade {
	
	public static ModelFacade getInstance(){
		if(facade == null){
			facade = new ModelFacade();
		}
		return facade;
	}
	
	public List<Restaurant> getListeRestaurants(){
		return ListeRestaurants.getInstance().getListeRestaurants();
	}
	
	public void attachObserverToCarnetCommandes(Observer o){
		CarnetCommandes.getInstance().addObserver(o);
	}
	
	public void placeCommande(){
		CarnetCommandes.getInstance().addCommande(currentCommande);
	}
	
	public void setCurrentSelection(Map<Plat, Integer> selection){
		currentCommande.setSelection(selection);
	}
	
	public void setCurrentRestaurant(Restaurant resto){
		currentCommande.setRestaurant(resto);
	}
	
	public void setCurrentAdress(String adresse){
		currentCommande.setAdresse(adresse);
	}
	
	public void setCurrentDeliveryTime(String heure){
		currentCommande.setHeure(heure);
	}
	
	public void setCurrentDeliveryDate(String date){
		currentCommande.setDate(date);
	}
	
	public Commande getCurrentCommande(){
		return currentCommande;
	}
	
	private ModelFacade(){
		
	}

	private static ModelFacade facade;
	private Commande currentCommande = new Commande();
}
